/**
 * 
 */
package net.kaizhong.excel.impl;

import org.apache.commons.lang.StringUtils;

import net.kaizhong.excel.Converter;

/**
 * @author huqifeng
 *
 */
public class GenderConverter implements Converter {

    /**
     * 
     */
    public GenderConverter() {

    }

    @Override
    public String convertOut(Object srcValue) {
        String destValue = "";
        if (StringUtils.isNotBlank(String.valueOf(srcValue))) {

            if ("F".equalsIgnoreCase(String.valueOf(srcValue))) {
                destValue = "女";
            } else if ("M".equalsIgnoreCase(String.valueOf(srcValue))) {
                destValue = "男";
            } else {
                destValue = "未知";
            }
        }
        return destValue;
    }

    @Override
    public Object convertIn(String srcValue) {
        String destValue = "";
        if (StringUtils.isNotBlank(String.valueOf(srcValue))) {

            if ("女".equalsIgnoreCase(String.valueOf(srcValue))) {
                destValue = "F";
            } else if ("男".equalsIgnoreCase(String.valueOf(srcValue))) {
                destValue = "M";
            }
        }
        return destValue;
    }

}
